package cn.innosmart.aq.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.HashMap;

/**
 * Created by David on 2016/1/18.
 */
public class Reminder implements Parcelable {
    public static final int NERVER = 0;
    public static final int EVERYPERIODICDAY = 1;
    public static final int EVERYOERIODICWEEK = 2;
    public String title;
    public String date;
    public String time;
    public int hour;
    public int minitue;
    public int year;
    public int month;
    public int day;
    public int repeat;
    public String content;
    public boolean isEnable;
    public int id;
    public HashMap<Integer, Long> repeatDatas;
    public int  repeatperiodic;

    public Reminder() {
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.title);
        dest.writeString(this.date);
        dest.writeString(this.time);
        dest.writeInt(this.hour);
        dest.writeInt(this.minitue);
        dest.writeInt(this.year);
        dest.writeInt(this.month);
        dest.writeInt(this.day);
        dest.writeInt(this.repeat);
        dest.writeString(this.content);
        dest.writeByte(isEnable ? (byte) 1 : (byte) 0);
        dest.writeInt(this.id);
        dest.writeSerializable(this.repeatDatas);
        dest.writeInt(this.repeatperiodic);
    }

    protected Reminder(Parcel in) {
        this.title = in.readString();
        this.date = in.readString();
        this.time = in.readString();
        this.hour = in.readInt();
        this.minitue = in.readInt();
        this.year = in.readInt();
        this.month = in.readInt();
        this.day = in.readInt();
        this.repeat = in.readInt();
        this.content = in.readString();
        this.isEnable = in.readByte() != 0;
        this.id = in.readInt();
        this.repeatDatas = (HashMap<Integer, Long>) in.readSerializable();
        this.repeatperiodic = in.readInt();
    }

    public static final Parcelable.Creator<Reminder> CREATOR = new Parcelable.Creator<Reminder>() {
        public Reminder createFromParcel(Parcel source) {
            return new Reminder(source);
        }

        public Reminder[] newArray(int size) {
            return new Reminder[size];
        }
    };
}
